#ifndef __MAIN_H
#define __MAIN_H

#define coreapi_DelayTime			0x08008e54+1
#define coreapi_GetRTC				0x08008e6c+1
#define coreapi_GetTicks   		0x08008e78+1
#define coreapi_PubTopic   		0x08008e84+1
#define coreapi_ReadPort1  		0x08008f94+1
#define coreapi_ReadPort2  		0x08008fec+1
#define coreapi_ReadRS232  		0x08009044+1
#define coreapi_ReceiveTopic  0x0800909c+1
#define coreapi_SetPort1  		0x080090a8+1
#define coreapi_SetPort2  		0x080090c4+1
#define coreapi_SetRS232  		0x080090e0+1
#define coreapi_WritePort1		0x0800912c+1
#define coreapi_WritePort2		0x0800913c+1
#define coreapi_WriteRS232		0x0800914c+1
#define coreapi_Malloc     		0x0800f60c+1
#define coreapi_Free       		0x0800fd74+1
#define coreapi_TaskCreate    0x080090fc+1

#define WorkInit(arg) 										((void (*)(void *))(coreapi_WorkInit))(arg)
#define GetTicks(arg) 										((int (*)(void))(coreapi_GetTicks))(arg)
#define DelayTime(arg) 										((void (*)(unsigned int))(coreapi_DelayTime))(arg)
#define GetRTC(arg)               				((void (*)(char *))(coreapi_GetRTC))(arg)
#define SetPort1(arg1,arg2,arg3,arg4)			((void (*)(unsigned int,unsigned char,unsigned char,unsigned char,unsigned char))(coreapi_SetPort1))(arg1,arg2,arg3,arg4)
#define SetPort2(arg1,arg2,arg3,arg4)			((void (*)(unsigned int,unsigned char,unsigned char,unsigned char,unsigned char))(coreapi_SetPort2))(arg1,arg2,arg3,arg4)
#define SetRS232(arg1,arg2,arg3,arg4)			((void (*)(unsigned int,unsigned char,unsigned char,unsigned char,unsigned char))(coreapi_SetRS232))(arg1,arg2,arg3,arg4)
#define WritePort1(arg1,arg2)			 				((void (*)(unsigned char *,unsigned short))(coreapi_WritePort1))(arg1,arg2)
#define WritePort2(arg1,arg2)			 				((void (*)(unsigned char *,unsigned short))(coreapi_WritePort2))(arg1,arg2)
#define WriteRS232(arg1,arg2)			 				((void (*)(unsigned char *,unsigned short))(coreapi_WriteRS232))(arg1,arg2)
#define ReadPort1(arg1,arg2)		  				((unsigned short(*)(unsigned char *,unsigned short))(coreapi_ReadPort1))(arg1,arg2)
#define ReadPort2(arg1,arg2)		  				((unsigned short(*)(unsigned char *,unsigned short))(coreapi_ReadPort2))(arg1,arg2)
#define ReadRS232(arg1,arg2)		  				((unsigned short(*)(unsigned char *,unsigned short))(coreapi_ReadRS232))(arg1,arg2)
#define PubTopic(arg1,arg2,arg3)	 				((int (*)(char *,char *,unsigned short))(coreapi_PubTopic))(arg1,arg2,arg3)
#define ReceiveTopic(arg1)							  ((void (*)(void *))(coreapi_ReceiveTopic))(arg1)
#define SafeMalloc(arg)           				((void * (*)(unsigned int))(coreapi_Malloc))(arg)
#define SafeFree(arg)           					((void (*)(void *))(coreapi_Free))(arg)
#define TaskCreate(arg)          					((void (*)(void *))(coreapi_TaskCreate))(arg)
#endif /* __MAIN_H */